<template>
    <ul class="newGoods">
        <li v-for="item in list" :key="item.id" @click="goProduct(item.id)">
            <img v-lazy="item.list_pic_url" alt="">
            <h3>{{ item.name }}</h3>
            <p> {{ item.retail_price | RMB }}</p>
        </li>
    </ul>
</template>

<script>
export default {
    props: ['list'],
    methods: {
        goProduct(id) {
            this.$router.push({ name: 'product', params: { id } })
        }
    }
}
</script>

<style lang="less" scoped>
.newGoods {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    background-color: #fff;

    li {
        width: 48%;
        font-size: 16px;

        img {
            width: 100%;
        }

        h3 {
            text-align: center;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        p {
            color: darkred;
            text-align: center;
            line-height: 30px;
        }
    }
}
</style>